<?php
/**
 * @name /www/admin/users.php
 * @author
 * @version 2011.03.30
 *
 * This is the admin page to show list of users.
 */

// Sets up configuration settings and includes libraries.
require_once('_ini.php');

// Libraries
ReqLib('/lib/private/NeededItem.php');


/**
 * Defines page content.
 *
 */
function DefineContent()
{
  // Page content goes here.
  ?>
<p>
  <a href="<?=_webroot('/') ?>">Home</a>.
</p>
<?
	if($_SESSION['userId'] >0){
?>
		<p>
		  <a href="<?=_webroot('/account.php') ?>">My Account</a>.
		</p>
		<p>
		  <a href="<?=_webroot('/logout.php') ?>">Logout</a>.
		</p>
<center>
	<table border="2">
		<tbody>
			<tr>
				<td colspan="3" align="center"><a href="AddNeededItem.php">Add New Needed Item</a></td>
			</tr>
			<tr><td>Needed Item Id</td><td>Item Name</td><td>Orphanage Name</td></tr>
<?

	foreach(NeededItem::GetNeededItems() as $ni)
	{
		println('<tr>');
		println("<td align=\"center\"><a href=editNeededItem.php?niId={$ni->NeededItemId}>{$ni->NeededItemId}</a></td><td>{$ni->ItemObject->Name}</td><td>{$ni->OrphanageObject->Name}</td>");
		println('</tr>');
	}

	println('</tboby></table></center>');

 }
   else{
?>
		<p>
		  <a href="<?=_webroot('/login_register.php') ?>">Login/Register</a>.
		</p>
<?
   }
}

// Launches the page; without this, nothing happens.
require_once('_loader.php');